Hi Klaus,
I had a very hard time with some dbf from foxpro 2.5 ! , the thing is that
you can read them without problem, either using OleDB or ODBC, the real
problem is writting on them sometimes I got errors, at the end I did a mix
solution, to some tables I write it from C# to others I create a prg file
and use the fox.exe to execute the script :(
Here is the code I'm using now, I use OleDB , so you need the vfpoledb.dll
its come with any installation of VFP
void ExecuteQuery( string DataSource, string Query)
{
string connString;
OleDbConnection conn;
OleDbCommand command;
try
{
connString = "Provider=VFPOLEDB.1;Data Source="+ DataSource + ";";
conn = new OleDbConnection( connString);
conn.Open();
command = new OleDbCommand();
command.Connection = conn;
command.CommandText = Query;
command.ExecuteNonQuery();
conn.Close();
}
catch(Exception e)
{
}
}
This is how I read the table:
void ReadTable( DataSet data, string sourceFile, string tablename)
{
try
{
string connString;
OleDbConnection conn;
OleDbDataAdapter adapter;
connString = "Provider=VFPOLEDB.1;Data Source="+ sourceFile + ";";
conn = new OleDbConnection( connString);
conn.Open();
adapter = new OleDbDataAdapter( "select * from " +
TableName(sourceFile), conn);
adapter.Fill( data, tablename);
conn.Close();
adapter = null;
}
catch(Exception e)
{
}
}
Hope this help,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Klaus Kaiser Apolinário" <kl***@curitibaonline.com.br> wrote in message
news:uO**************@TK2MSFTNGP09.phx.gbl...
Guys,
I have a DBF ( :-S ) pseud-database here, and I need to access this dbf
with C#, how I can make this???
Klaus Kaiser Apolinário
COL